home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / vimrc_example.vim < prev   
Encoding:
Text File  |  2001-07-19  |  2.4 KB  |  76 lines

  1. " An example for a vimrc file.
  2. "
  3. " Maintainer:    Bram Moolenaar <Bram@vim.org>
  4. " Last change:    2001 Jul 18
  5. "
  6. " To use it, copy it to
  7. "     for Unix and OS/2:  ~/.vimrc
  8. "          for Amiga:  s:.vimrc
  9. "  for MS-DOS and Win32:  $VIM\_vimrc
  10. "        for OpenVMS:  sys$login:.vimrc
  11.  
  12. " When started as "evim", evim.vim will already have done these settings.
  13. if v:progname =~? "evim"
  14.   finish
  15. endif
  16.  
  17. " Use Vim settings, rather then Vi settings (much better!).
  18. " This must be first, because it changes other options as a side effect.
  19. set nocompatible
  20.  
  21. " allow backspacing over everything in insert mode
  22. set backspace=indent,eol,start
  23.  
  24. set autoindent        " always set autoindenting on
  25. if has("vms")
  26.   set nobackup        " do not keep a backup file, use versions instead
  27. else
  28.   set backup        " keep a backup file
  29. endif
  30. set history=50        " keep 50 lines of command line history
  31. set ruler        " show the cursor position all the time
  32. set showcmd        " display incomplete commands
  33. set incsearch        " do incremental searching
  34.  
  35. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  36. " let &guioptions = substitute(&guioptions, "t", "", "g")
  37.  
  38. " Don't use Ex mode, use Q for formatting
  39. map Q gq
  40.  
  41. " Make p in Visual mode replace the selected text with the "" register.
  42. vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>
  43.  
  44. " This is an alternative that also works in block mode, but the deleted
  45. " text is lost and it only works for putting the current register.
  46. "vnoremap p "_dp
  47.  
  48. " Switch syntax highlighting on, when the terminal has colors
  49. " Also switch on highlighting the last used search pattern.
  50. if &t_Co > 2 || has("gui_running")
  51.   syntax on
  52.   set hlsearch
  53. endif
  54.  
  55. " Only do this part when compiled with support for autocommands.
  56. if has("autocmd")
  57.  
  58.   " Enable file type detection.
  59.   " Use the default filetype settings, so that mail gets 'tw' set to 72,
  60.   " 'cindent' is on in C files, etc.
  61.   " Also load indent files, to automatically do language-dependent indenting.
  62.   filetype plugin indent on
  63.  
  64.   " For all text files set 'textwidth' to 78 characters.
  65.   autocmd FileType text setlocal textwidth=78
  66.  
  67.   " When editing a file, always jump to the last known cursor position.
  68.   " Don't do it when the position is invalid or when inside an event handler
  69.   " (happens when dropping a file on gvim).
  70.   autocmd BufReadPost *
  71.     \ if line("'\"") > 0 && line("'\"") <= line("$") |
  72.     \   exe "normal g`\"" |
  73.     \ endif
  74.  
  75. endif " has("autocmd")
  76.